<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	
	$(function() {
		$('#orderId').change(function() {
			var val = $(this).val();
			val = $.trim(val);
			$(this).val(val);
	
			var url = "${pageContext.request.contextPath }/order/ajaxValidateOrderId.do";
			var args = {
				'orderId' : val,
				'date' : new Date()
			};
			$.post(url, args, function(data) {
				document.getElementById("reg_err").innerHTML = "";
				if (data == '0') {
					document.getElementById("reg_err").innerHTML = "订单不存在，请确认！";
				} else if (data == '1') {
					/* document.getElementById("reg_err").innerHTML = "用户名已存在！"; */
				} else {
					document.getElementById("reg_err").innerHTML = "网络故障！";
				}
			});
		});
	});
	
	function checkForm(){
		var step=$("#step").val();
		if(step==null || step==""){
			$("#error").html("进度不能为空！");
			return false;
		}
		return true;
	}
	
	
	function resetValue(){
		//$("#deptName").val("");
		$("#step").val("");
	}
</script>
</head>
<body>
<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">${actionName }</h3>
  </div>
  <div class="panel-body">
    <form class="form-horizontal" method="post" action="${pageContext.request.contextPath}/status/save.do" onsubmit="return checkForm()">
	  <%-- <div class="form-group">
	    <label class="col-sm-2 control-label">进度：</label>
	    <div class="col-sm-10">
	      <input type="text" class="form-control" id="step" name="step" value="${status.step }" style="width: 300px">
	    </div>
	  </div> --%>
	  <div class="form-group">
	    <label  class="col-sm-2 control-label">订单号：</label>
	    <div class="col-sm-10">
	    	<input type="text" class="form-control" id="orderId" name="orderId" value="${status.orderId }" style="width: 300px">
	    </div>
	  </div>
	  <div class="form-group">
	  	<label class="col-sm-2 control-label"></label>
	  	<p class="col-sm-10 text-danger" id="reg_err">${errorMsg }</p>
	  </div>
	  <div class="form-group">
	    <label  class="col-sm-2 control-label">地点和跟踪进度：</label>
	    <div class="col-sm-10">
	      <textarea class="form-control" rows="4" id="step" name="step">${status.step }</textarea>
	    </div>
	  </div>
	  <div class="form-group">
	    <div class="col-sm-offset-2 col-sm-10">
	      <input type="hidden" id="id" name="id" value="${status.id }"/>
	      <button type="submit" class="btn btn-primary">保存</button>&nbsp;&nbsp;
	      <button type="button" class="btn btn-primary" onclick="resetValue()">重置</button>&nbsp;&nbsp;
	      <font color="red" id="error"></font>
	    </div>
	  </div>
  </div>
</div>
</body>
</html>